package tf_rna_hit;
/**
 *  2016.08.14调整，用来保存匹配的tf和rna的信息
 *  包含rna的位点信息
 * @author ygidtu
 *
 */
public class RnaTf {
	private String tf;
	private String rna;
	private int numOfHit;
	private String chr;
	private int start;
	private int end;
	private String strand;
	private int tss;
	private int blockstart;
	private int blockend;
	
	// constructors	
	public RnaTf(String rna, String tf, String chr, int start, int end, String strand, int tss){
		setRna(rna);
		setTf(tf);		
		setStrand(strand);
		setChr(chr);
		setStart(start);
		setEnd(end);
		setBlock(tss);
		this.tss = tss;
	}
	public RnaTf(){
		this.rna = "NA";
		this.tf = "NA";
		this.chr = "NA";
		this.strand = "NA";
		this.start = 0;
		this.end = 0;
		this.numOfHit = 0;
	}
	// setters
	public void setRna(String rna){
		this.rna = rna;
	}
	public void setTf(String tf){
		this.tf = tf;
	}
	public void setChr(String chr){
		this.chr = chr;
	}
	public void setStrand(String strand){
		this.strand = strand;
	}
	public void setStart(int start){
		this.start = start;
	}
	public void setEnd(int end){
		this.end = end;
	}
	public void setnumOfHits(int num){
		this.numOfHit = num;
	}
	public void setBlockstart(int blockstart){
		this.blockstart = blockstart;
	}
	public void setBlockend(int end){
		this.blockend = end;
	}

	
	public void setBlock(int tss){
		if(this.strand.equals("-")){
			this.blockstart = tss - 1000;
			this.blockend = tss + 5000;
		}else{
			this.blockstart = tss - 5000;
			this.blockend = tss + 1000;
		}
	}
	// getters
	public String getRna(){
		return this.rna;
	}

	public String getTf(){
		return this.tf;
	}
	public String getStrand(){
		return this.strand;
	}
	public String getChr(){
		return this.chr;
	}
	public int getStart(){
		return this.start;
	}
	public int getEnd(){
		return this.end;
	}
	public int getnumOfHits(){
		return this.numOfHit;
	}
	public String getBlock(){
		return ("[" + this.blockstart + ":" + this.blockend + "]");
	}
	public int getBlockstart(){
		return this.blockstart;
	}
	public int getBlockend(){
		return this.blockend;
	}
	// 输出类
	public String printAll(){
		return this.rna + "\t" + this.tf + "\t" + this.chr + ":" + this.start + "-"
				+ this.end + "\t" + this.strand + "\t" + this.tss + "\t" + this.numOfHit;
	}
	public String printAllheader(){
		return "RNA" + "\t" + "TF" + "\t" + "RNA位置" + "\t" + "链" + "\t" + "lncRNA的TSS" + "\t" + "匹配个数";
	}
	
	public String printHit(){
		return this.rna + "\t" + this.tf + "\t" + this.chr + ":" + this.start + "-" + this.end + "\t" + this.strand + "\t";
	}
	public String printHitheader(){
		return "RNA" + "\t" + "TF" + "\t" + "pos_of_rna" + "\t" + "strand"; //  + "\t" + "pos_of-Tf";
	}
	
	public String printTem(){
		return this.rna + "\t" + this.tf + "\t" + this.chr + "\t" + this.start + "\t" + this.end + "\t" + this.strand + "\t" + this.tss;
	}
}
